<?php
/**
 * 
 * @author chenlisong
 *
 */
class BaseAction extends Action{
	
	/**
	 * 前置操作
	 */
	public function _initialize(){
		header('Content-Type:application/json; charset=utf-8');
 		$this->param = $_REQUEST;
 		//需要登录的类
 		if(in_array(MODULE_NAME, array('Order','User'))){
 			if (!isset($_SESSION['HS_USER_ID'])) {
 				//保存登录前的链接
 				cookie('HREF_COOKIE',__ROOT__.'/'.MODULE_NAME.'/'.ACTION_NAME);
 				redirect(U('Login/index'));
 			}
 		}
 		//需要分类的类
 		if(!in_array(MODULE_NAME, array('Login'))){
 			//获取分类
 			$typeList = getProductType();
 			$this->assign('typeList',json_decode($typeList,true));
 			//获取热搜关键字
 			$keyword = getHotKeyword();
 			$this->assign('keyword',json_decode($keyword,true));
 		}
 		
	}
	
}